<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>book_desc.jsp</title>
	<meta http-equiv="content-type" content="text/html;charset=utf-8">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link rel="stylesheet" type="text/css" href="<c:url value='/adminjsps/admin/css/book/desc.css'/>">
<link rel="stylesheet" type="text/css" href="<c:url value='/jquery/jquery.datepick.css'/>">
<script type="text/javascript" src="<c:url value='/jquery/jquery-1.5.1.js'/>"></script>
<script type="text/javascript" src="<c:url value='/jquery/jquery.datepick.js'/>"></script>
<script type="text/javascript" src="<c:url value='/jquery/jquery.datepick-zh-CN.js'/>"></script>

<script type="text/javascript" src="<c:url value='/adminjsps/admin/js/book/desc.js'/>"></script>

<script type="text/javascript">

$(function() {
	$("#box").attr("checked", false);
	$("#formDiv").css("display", "none");
	$("#show").css("display", "");	
	
	// 操作和显示切换
	$("#box").click(function() {
		if($(this).attr("checked")) {
			$("#show").css("display", "none");
			$("#formDiv").css("display", "");
		} else {
			$("#formDiv").css("display", "none");
			$("#show").css("display", "");		
		}
	});
});

function loadChildren() {
	// 1. 获取pid
	var pid = $("#pid").val();
	// 2. 发送异步请求
	$.ajax({
		async:true,
		cache:false,
		url:"/carSalesSystem/admin/book/ajaxFindChildren.do",
		data:{pid:pid},
		type:"POST",
		dataType:"json",
		success:function(arr) {
			// 3. 得到cid，删除它的内容
			$("#cid").empty();//删除元素的子元素
			$("#cid").append($("<option>====请选择2级分类====</option>"));//4.添加头
			// 5. 循环遍历数组，把每个对象转换成<option>添加到cid中
			for(var i = 0; i < arr.length; i++) {
				var option = $("<option>").val(arr[i].cid).text(arr[i].cname);
				$("#cid").append(option);
			}
		}
	});
}

function editForm(){
	$("#form").attr("action", "/carSalesSystem/admin/car/edit.do");
	$("#form").submit();
}
function delForm(){
	$("#form").attr("action", "/carSalesSystem/admin/car/delete.do");
	$("#form").submit();
}
</script>
  </head>
  
  <body>
    <input type="checkbox" id="box"><label for="box">编辑或删除</label>
    <br/>
    <br/>
  <div id="show">
    <div class="sm">${car.bname }</div>
    <img align="top" src="<c:url value='/${car.image_w }'/>" class="tp"/>
    <div id="book" style="float:left;">
	    <ul>
	    	<li>商品编号：${car.carNo }</li>
	    	<li>当前价：<span class="price_n">&yen;${car.currPrice }</span></li>
	    	<li>定价：<span style="text-decoration:line-through;">&yen;${car.price }</span>　折扣：<span style="color: #c30;">${car.discount }</span>折</li>
	    </ul>
		<hr style="margin-left: 50px; height: 1px; color: #dcdcdc"/>
		<table class="tab">
			<tr>
				<td colspan="3">
					制造商：${car.manufacturer }
				</td>
			</tr>
			<tr>
				<td colspan="3">
					供应商：${car.supplier }</a>
				</td>
			</tr>
			<tr>
				<td colspan="3">品牌：${car.brand }</td>
			</tr>
			<tr>
				<td>发动机型号：${car.engineModel }</td>
				<td>轮胎品牌：${car.tyreBrand }</td>
			</tr>
			<tr>
				<td width="180">出厂时间：${car.factoryTime }</td>
				<td width="180">上市时间：${car.publishTime }</td>
			</tr>
		</table>
	</div>
  </div>
  
  <div id='formDiv'>
   <div class="sm">&nbsp;</div>
   <form action="" method="post" id="form">
    <img align="top" src="<c:url value='/${car.image_w }'/>" class="tp"/>
    <div style="float:left;">
	    <ul>
	    	<li><input type="hidden" name="carNo" value="${car.carNo }"/>商品编号：${car.carNo }</li>
	    	<li>名称：　<input id="bname" type="text" name="bname" value="${car.bname }" style="width:500px;"/></li>
	    	<li>当前价：<input id="currPrice" type="text" name="currPrice" value="${car.currPrice }" style="width:50px;"/></li>
	    	<li>定价：　<input id="price" type="text" name="price" value="${car.price }" style="width:50px;"/>
	    	折扣：<input id="discount" type="text" name="discount" value="${car.discount }" style="width:30px;"/>折</li>
	    </ul>
		<hr style="margin-left: 50px; height: 1px; color: #dcdcdc"/>
		<table class="tab">
			<tr>
				<td colspan="3">
					制造商：　　<input id="manufacturer" type="text" name="manufacturer" value="${car.manufacturer }" style="width:150px;"/>
				</td>
			</tr>
			<tr>
				<td colspan="3">
					供应商：　<input id="supplier" type="text" name="supplier" value="${car.supplier }" style="width:200px;"/>
				</td>
			</tr>
			<tr>
				<td colspan="3">品牌：<input id="brand" type="text" name="brand" value="${car.brand }" style="width:100px;"/></td>
			</tr>
			<tr>
				<td>发动机型号：　　<input id="engineModel" type="text" name="engineModel" value="${car.engineModel }" style="width:40px;"/></td>
				<td>轮胎品牌：　　<input id="tyreBrand" type="text" name="tyreBrand" value="${car.tyreBrand }" style="width:50px;"/></td>
			</tr>
			<tr>
				<td width="250px">出厂时间：<input id="factoryTime" type="text" name="factoryTime" value="${car.factoryTime }" style="width:100px;"/></td>
				<td width="250px">上市时间：　　<input id="publishTime" type="text" name="publishTime" value="${car.publishTime }" style="width:30px;"/></td>
			</tr>
			<tr>
				<td colspan="2">
					<input onclick="editForm()" type="button" name="method" id="editBtn" class="btn" value="编　　辑">
					<input onclick="delForm()" type="button" name="method" id="delBtn" class="btn" value="删　　除">
				</td>
				<td></td>
			</tr>
		</table>
	</div>
   </form>
  </div>

  </body>
</html>
